﻿using System;
using System.Windows.Forms;
using System.Collections.Generic;

namespace Rem.Objects.Forms
{
    public class BaseUserControl : UserControl
    {
        public virtual bool Save()
        {
            if (Saved != null)
                Saved(this.Data, null);
            return true;
        }

        public virtual void Cancel()
        {

        }
        protected bool _isDirty;
        public bool IsDirty { get { return _isDirty; } }

        protected List<Control> _dirtiedControls;
        public List<Control> DirtiedControls { get; set; }
        protected bool loading;

        public bool Loading
        {
            get { return loading; }
            set { loading = value; }
        }
        public event EventHandler Dirtied;

        public virtual Object Data { get; set; }
        public event EventHandler Saved;
        public EventHandler Deleted { get; set; }
    }
}
